package main

import "fmt"

func updateSlice(s []int)  { // []不加长度就是个切片
	s[0] = 100
}

func main() {
	arr := [...]int{0, 1, 2, 3, 4, 5, 6 ,7, 8}
	fmt.Println("arr[2:6] = ", arr[2:6])
	fmt.Println("arr[2:] = ", arr[2:])
	fmt.Println("arr[:6] = ", arr[2:])
	fmt.Println("arr[:] = ", arr[:])
	updateSlice(arr[2:])
	updateSlice(arr[:])
	fmt.Println(arr)
	fmt.Println("Extentding slice")
	s1 := arr[2:6]
	s2 := s1[3:6]
	fmt.Println("s1 = ", s1)
	fmt.Println("s2 = ", s2)
	fmt.Printf("s1=%v, len(s1)=%d, cap(s1)=%d\n",
		s1, len(s1), cap(s1))
}
